package fa.wangxing.leaf.Service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import fa.wangxing.leaf.Mapper.OrderMapper;
import fa.wangxing.leaf.Service.OrderService;
import fa.wangxing.leaf.pojo.Cart;
import fa.wangxing.leaf.pojo.Dishes;
import fa.wangxing.leaf.pojo.Order;
import fa.wangxing.leaf.pojo.Orderitems;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceiml implements OrderService {
    @Resource
    private OrderMapper orderMapper;

    public List<Cart> getcart(int user_id) {
        return orderMapper.getcart(user_id);
    }

    public void createorder(Order order) {
        orderMapper.createorder(order);
    }

    public int getnewestorder(int user_id) {
        return orderMapper.getnewestorder(user_id);
    }

    public void addItem(Orderitems item) {
        orderMapper.additem(item);
    }

    @Override
    public void cleancart(int user_id) {
        orderMapper.cleancart(user_id);
    }

    public List<Order> getorder(int user_id) {
        List<Order> list = orderMapper.getorder(user_id);
        return list;
    }

    public List<Dishes> getdishes(int order_id) {
        return orderMapper.getdishes(order_id);
    }

    public Order getOrderbyid(int order_id) {
        return orderMapper.getOrderbyid(order_id);
    }

    @Override
    public void cancleorder(int order_id) {
        orderMapper.cancleorder(order_id);
    }

    @Override
    public void payorder(int order_id) {
        orderMapper.payorder(order_id);
    }
}
